package com.wcs.exam.common.base;

public interface BaseEnum {

    /**
     * 获取枚举类的值
     */
    Object getCode();

    /**
     * 获取枚举类的说明
     */
    String getDesc();

    /**
     * @param clazz 枚举类类对象
     */
    static String getInfo(Class<? extends BaseEnum> clazz) {
        BaseEnum[] enums = clazz.getEnumConstants();
        StringBuilder sb = new StringBuilder();
        for (BaseEnum e : enums) {
            sb.append(e.getCode()).append(":").append(e.getDesc()).append(", ");
        }
        return sb.substring(0, sb.length() - 2);
    }

}